package main

import (
	"time"
	"log"
)

func main() {

	type Client struct {
		id string
		access time.Time
	}

	now := time.Now()


	c1 := &Client{"c1", time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), now.Nanosecond(), time.Local)}
 	c2 := &Client{"c2", time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second() + 5, now.Nanosecond(), time.Local)}

	log.Println(now)
	tick := time.Tick(10*time.Second)

 	for{
		select {
		case <-tick:

			if c1.access.Add(2 * time.Second).Before(time.Now()) {
				c1.access = time.Now()
				log.Println("c1 timeout")
			}

			if c2.access.Add(4 * time.Second).Before(time.Now()) {
				c2.access = time.Now()
				log.Println("c2 timeout")
			}

		}
	}
	
}
